class SRVetFirebug extends SRVeterancyTypes
	abstract;

static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
	switch( CurLevel )
	{
	case 0:
		FinalInt = 10000;
		break;
	case 1:
		FinalInt = 25000;
		break;
	case 2:
		FinalInt = 100000;
		break;
	case 3:
		FinalInt = 500000;
		break;
	case 4:
		FinalInt = 1500000;
		break;
	case 5:
		FinalInt = 3500000;
		break;
	case 6:
		FinalInt = 5500000;
		break;
	default:
		if (CurLevel<=12)
			FinalInt = 5500000+GetDoubleScaling(CurLevel,500000);
		else
		{
			if (StatOther.RequirementScaling < 1.0)
				FinalInt = ((5500000+GetDoubleScaling(CurLevel,500000))/StatOther.RequirementScaling)*2;
			else
				FinalInt = ((5500000+GetDoubleScaling(CurLevel,500000))*StatOther.RequirementScaling)*2;
		}
	}
	return Min(StatOther.RFlameThrowerDamageStat,FinalInt);
}

static function float GetMagCapacityMod(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
    local float res;
    if ( Flamethrower(Other) != none && KFPRI.ClientVeteranSkillLevel > 0 )
    {
        res = 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 60% larger fuel canister
        if ( KFPRI.ClientVeteranSkillLevel > 6 )
        {
            res+=0.20 * float(KFPRI.ClientVeteranSkillLevel-6);
        }
        return res;
    }
//	if ( Flamethrower(Other) != none && KFPRI.ClientVeteranSkillLevel > 0 )
//		return 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 60% larger fuel canister
	if( (MAC10MP(Other) != none 
		|| Other.IsA('FN2000AssaultRifle'))
		&& KFPRI.ClientVeteranSkillLevel > 0 )
		return 1.0 + (0.12 * FMin(float(KFPRI.ClientVeteranSkillLevel), 5.0)); // 60% increase in MAC10 ammo carry
	return 1.0;
}
static function float GetAmmoPickupMod(KFPlayerReplicationInfo KFPRI, KFAmmunition Other)
{
    local float res;
	if ( FlameAmmo(Other) != none && KFPRI.ClientVeteranSkillLevel > 0 )
    {
		res = 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 60% larger fuel canister
        if (KFPRI.ClientVeteranSkillLevel > 6)
        {
            res+=0.20 * float(KFPRI.ClientVeteranSkillLevel-6);
        }
        return res;
    }
	if ( MAC10Ammo(Other) != none && KFPRI.ClientVeteranSkillLevel > 0 )
	{
		return 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 60% increase in MAC10 ammo carry
	}
	if ( HuskGunAmmo(Other) != none && KFPRI.ClientVeteranSkillLevel > 0 )
	{
		return 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // 60% increase in Husk gun ammo carry
	}
	return 1.0;
}
static function float AddExtraAmmoFor(KFPlayerReplicationInfo KFPRI, Class<Ammunition> AmmoType)
{
    local float res;
	if ( (AmmoType == class'WTFEquipFTAmmo') && KFPRI.ClientVeteranSkillLevel > 0 )
	{
		return 1.0 + (0.20 * float(KFPRI.ClientVeteranSkillLevel));
	}
	else if ( AmmoType == class'FlameAmmo' && KFPRI.ClientVeteranSkillLevel > 0 )
    {
		res = 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 60% larger fuel canister
        if (KFPRI.ClientVeteranSkillLevel > 6)
        {
            res+=0.20 * float(KFPRI.ClientVeteranSkillLevel-6);
        }
        return res;
    }
	else if( (AmmoType == class'HuskGunAmmo'
				|| AmmoType == class'TrenchgunAmmo'
				|| AmmoType == class'FlareRevolverAmmo') && KFPRI.ClientVeteranSkillLevel > 0 )
	{
		return 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 60% increase in Husk gun ammo carry
	}
	return 1.0;
}

static function int AddDamage(KFPlayerReplicationInfo KFPRI, KFMonster Injured, KFPawn DamageTaker, int InDamage, class<DamageType> DmgType)
{
	if( DmgType == class'KFMod.DamTypeBurned'
		|| DmgType == class'KFMod.DamTypeFlamethrower'
		|| DmgType == class'DamTypeHuskGunProjectileImpact'
		|| DmgType == class'DamTypeFlareProjectileImpact')
	{
		if ( KFPRI.ClientVeteranSkillLevel == 0 )
			return float(InDamage) * 1.05;
		else if ( KFPRI.ClientVeteranSkillLevel <= 6 )
			return float(InDamage) * (1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel))); //  Up to 60% extra damage
		else
			return float(InDamage) * (1.6 + (0.05 * float(KFPRI.ClientVeteranSkillLevel-6))); //  Up to 60% extra damage
		//return float(InDamage) * (1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel))); //  Up to 60% extra damage
	}
	return InDamage;
}

// Change effective range on FlameThrower
static function int ExtraRange(KFPlayerReplicationInfo KFPRI)
{
	if ( KFPRI.ClientVeteranSkillLevel <= 2 )
		return 0;
	else if ( KFPRI.ClientVeteranSkillLevel <= 4 )
		return 1; // 50% Longer Range
	return 2; // 100% Longer Range
}

static function int ReduceDamage(KFPlayerReplicationInfo KFPRI, KFPawn Injured, KFMonster DamageTaker, int InDamage, class<DamageType> DmgType)
{
	if ( class<DamTypeBurned>(DmgType) != none
		|| class<DamTypeFlamethrower>(DmgType) != none
		|| DmgType==class'KFMod.DamTypeBurned'
		|| DmgType==class'KFMod.DamTypeFlamethrower'
		|| DmgType == class'DamTypeHuskGunProjectileImpact'
		|| DmgType == class'DamTypeFlareProjectileImpact')
	{
		if ( KFPRI.ClientVeteranSkillLevel <= 3 )
			return float(InDamage) * (0.50 - (0.10 * float(KFPRI.ClientVeteranSkillLevel)));
		return 0; // 100% reduction in damage from fire
	}
	return InDamage;
}

static function class<Grenade> GetNadeType(KFPlayerReplicationInfo KFPRI)
{
	if ( KFPRI.ClientVeteranSkillLevel >= 3 )
		return class'FlameNade'; // Grenade detonations cause enemies to catch fire
	return super.GetNadeType(KFPRI);
}

static function float GetReloadSpeedModifier(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	if ( WTFEquipFT(Other) != none
		|| Flamethrower(Other) != none 
		|| Trenchgun(Other) != none
		|| FlareRevolver(Other) != none
		|| DualFlareRevolver(Other) != none)
	{
		if ( KFPRI.ClientVeteranSkillLevel == 0 )
			return 1.0;
		return 1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 60% faster reload with Flamethrower
	}
	if ( MAC10MP(Other) != none )
	{
		if ( KFPRI.ClientVeteranSkillLevel == 0 )
			return 1.0;
		return 1.0 + (0.05 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 30% faster reload with MAC-10
	}
	return 1.0;
}

// Change the cost of particular items
static function float GetCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	if( Item == class'FlameThrowerPickup'
		|| Item == class'MAC10Pickup'
		|| Item == class'HuskGunPickup'
		|| Item == class'TrenchgunPickup'
		|| Item == class'FlareRevolverPickup'
        || Item == class'DualFlareRevolverPickup')
			return FMax(0.9 - (0.10 * float(KFPRI.ClientVeteranSkillLevel)),0.1); // Up to 70% discount on Flame Thrower
	else if ( Item == class'WTFEquipFTPickup' )
		return FMax(0.9 - (0.10 * float(KFPRI.ClientVeteranSkillLevel)),0.2); // Up to 70% discount
	else if ( Item == class'WTFEquipM79CFPickup' )
		return FMax(1.0 - (0.05 * float(KFPRI.ClientVeteranSkillLevel)),0.2); // Up to 35% discount
	else if ( Item == class'KFProd.M32Pickup' || Item == class'KFProd.M79Pickup' || Item == class'UnitedMut_v54.MolotovPickup')
		return FMax(-0.0417f*float(KFPRI.ClientVeteranSkillLevel)+0.99f,0.1); // 2500 to 1250 on 12 lvl
	else if ( Item.Name == 'FN2000Pickup' )
		return FMax(-0.0625*float(KFPRI.ClientVeteranSkillLevel) + 0.9583, 0.1); // 0 - 4000; 6 - 2000; 12 - 1000
	return 1.0;
}

static function float GetAmmoCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	if ( Item == class'WTFEquipNadePickup' )
	{
		return 0.95 - (0.05 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 35% discount on flame nades
	}
	return 1.0;
}

// Give Extra Items as default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	local int Lvl; Lvl=KFPRI.ClientVeteranSkillLevel;
	// If Level 5 or 6, give them a Flame Thrower
	if ( Lvl == 5 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.FlameThrower", GetCostScaling(KFPRI, class'FlamethrowerPickup'));
    if ( Lvl >= 6 )
    {
    	KFHumanPawn(P).CreateInventoryVeterancy("UnitedMut_v54.WTFEquipFT", GetCostScaling(KFPRI, class'WTFEquipFTPickup'));
    	P.ShieldStrength = 100;
    }
	if ( In(Lvl,6,10) )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.MAC10MP", GetCostScaling(KFPRI, class'MAC10Pickup'));

	if ( Lvl >= 10 )
	{
		//KFHumanPawn(P).CreateInventoryVeterancy("UnitedMut_v54.Molotov", GetCostScaling(KFPRI, class'MolotovPickup'));
		KFHumanPawn(P).CreateInventory("UnitedMut_v54.WTFEquipFlaregun");
	}

	if ( In(Lvl,11,11) )
		KFHumanPawn(P).CreateInventoryVeterancy("KFProd.M79GrenadeLauncher", GetCostScaling(KFPRI, class'KFProd.M79Pickup'));
	if ( Lvl >= 12 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFProd.M32GrenadeLauncher", GetCostScaling(KFPRI, class'KFProd.M32Pickup'));
}

static function int AddCarryMaxWeight(KFPlayerReplicationInfo KFPRI)
{
	if ( KFPRI.ClientVeteranSkillLevel >= 11 )
		return 2;
}

static function class<DamageType> GetMAC10DamageType(KFPlayerReplicationInfo KFPRI)
{
	return class'DamTypeMAC10MPInc';
}

static function string GetCustomLevelInfo( byte Level )
{
	local string S;

	S = Default.CustomLevelInfo;
    if (Level > 6)
    {
        ReplaceText(S,"%s",GetPercentStr(0.1 * float(Level) + 0.2 * float(Level-6)));
    }
    else
    {
        ReplaceText(S,"%s",GetPercentStr(0.05f * float(Level)));
    }
	ReplaceText(S,"%m",GetPercentStr(0.05 * float(Level)));
	ReplaceText(S,"%d",GetPercentStr(0.1+FMin(0.1 * float(Level),0.8f)));
	return S;
}

defaultproperties
{
     CustomLevelInfo="%s extra Flamethrower/Mac10 damage|%s faster Flamethrower reload|%m faster Mac10 reload|%s larger fuel canister|%s larger Mac10 clip|100% resistance to fire|100% extra Flamethrower range|Grenades set enemies on fire|%d discount on the FlameThrower/Mac10|Spawn with a Mac10 and Body Armor"
     SRLevelEffects(0)="5% extra Flamethrower/Mac10 damage|50% resistance to fire|10% discount on the Flamethrower/Mac10"
     SRLevelEffects(1)="10% extra Flamethrower/Mac10 damage|10% faster Flamethrower reload|5% faster Mac10 reload|10% larger fuel canister|12% larger Mac10 clip|60% resistance to fire|20% discount on the Flamethrower/Mac10"
     SRLevelEffects(2)="20% extra Flamethrower/Mac10 damage|20% faster Flamethrower reload|10% faster Mac10 reload|20% larger fuel canister|24% larger Mac10 clip|70% resistance to fire|30% discount on the Flamethrower/Mac10"
     SRLevelEffects(3)="30% extra Flamethrower/Mac10 damage|30% faster Flamethrower reload|15% faster Mac10 reload|30% larger fuel canister|36% larger Mac10 clip|80% resistance to fire|50% extra Flamethrower range|Grenades set enemies on fire|40% discount on the Flamethrower/Mac10"
     SRLevelEffects(4)="40% extra Flamethrower/Mac10 damage|40% faster Flamethrower reload|20% faster Mac10 reload|40% larger fuel canister|48% larger Mac10 clip|90% resistance to fire|50% extra Flamethrower range|Grenades set enemies on fire|50% discount on the Flamethrower/Mac10"
     SRLevelEffects(5)="50% extra Flamethrower/Mac10 damage|50% faster Flamethrower reload|25% faster Mac10 reload|50% larger fuel canister|60% larger Mac10 clip|100% resistance to fire|100% extra Flamethrower range|Grenades set enemies on fire|60% discount on the FlameThrower/Mac10|Spawn with a Flamethrower"
     SRLevelEffects(6)="60% extra Flamethrower/Mac10 damage|60% faster Flamethrower reload|30% faster Mac10 reload|60% larger fuel canister|60% larger Mac10 clip|100% resistance to fire|100% extra Flamethrower range|Grenades set enemies on fire|70% discount on the FlameThrower/Mac10|Spawn with a Mac10 and Body Armor"
     PerkIndex=5
     OnHUDIcon=Texture'KillingFloorHUD.Perks.Perk_Firebug'
     OnHUDGoldIcon=Texture'KillingFloor2HUD.Perk_Icons.Perk_Firebug_Gold'
	 OnHudIconOutline=Texture'Perks_T.Perk_Firebug_Outline'
     VeterancyName="Firebug"
     Requirements(0)="Deal %x damage with the Flamethrower"
}
